package org.dwell.urlfilter.demo.controller;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Jange on 2016/4/6.
 */
@Controller
public class IndexController extends BaseController {
    @RequestMapping(value = "/", method = RequestMethod.GET)
    public String index(Model model) {
        Subject user = SecurityUtils.getSubject();
        if(user.isAuthenticated()) {
            return "welcome";
        }
        model.addAttribute("message", user.getSession().getAttribute("message"));
        return "index";
    }
}
